﻿using System;
using System.Collections.Generic;
using DataManageSystem.Models.LimsModels;
using Microsoft.EntityFrameworkCore;
using Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal;

namespace DataManageSystem.Data;

public partial class DeviceDbContext : DbContext
{
    public DeviceDbContext() { }

    public DeviceDbContext(DbContextOptions<DeviceDbContext> options)
        : base(options) { }

    public virtual DbSet<TEquipment> TEquipments { get; set; }
    public virtual DbSet<TSafeMonitor> TSafeMonitors { get; set; }
    public virtual DbSet<TRegister> TRegisters { get; set; }
    public virtual DbSet<TRegisterStateKey> TRegisterStateKeys { get; set; }
    public virtual DbSet<TObjectAttribute> TObjectAttributes { get; set; }
    public virtual DbSet<TAccount> TAccounts { get; set; }
    public virtual DbSet<TAttributeRecord> TAttributeRecords { get; set; }
    public virtual DbSet<TEquipmentEnergyConsume> TEquipmentEnergyConsumes { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        if (!optionsBuilder.IsConfigured) // 确保只有在没有配置的情况下才手动配置
        {
            optionsBuilder.UseMySql(
                "Server=localhost;Database=honey;User=root;Password=123456;",
                ServerVersion.AutoDetect(
                    "Server=localhost;Database=honey;User=root;Password=123456;"
                )
            );
        }
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.UseCollation("utf8mb4_0900_ai_ci").HasCharSet("utf8mb4");

        modelBuilder.Entity<TEquipment>(entity =>
        {
            entity.HasKey(e => e.Guid).HasName("PRIMARY");

            entity.ToTable("t_equipment").UseCollation("utf8mb4_general_ci");

            entity.Property(e => e.Guid).HasMaxLength(64).HasComment("主键").HasColumnName("guid");
            entity
                .Property(e => e.AdditionalInfo)
                .HasComment("额外的信息")
                .HasColumnType("json")
                .HasColumnName("additional_info");
            entity
                .Property(e => e.AdministratorGuid)
                .HasMaxLength(255)
                .HasComment("负责人Guid")
                .HasColumnName("administrator_guid");
            entity
                .Property(e => e.BatchNumber)
                .HasMaxLength(255)
                .HasComment("批号")
                .HasColumnName("batch_number");
            entity
                .Property(e => e.BeControlled)
                .HasComment("是否可被控制，0：否，1：是")
                .HasColumnName("be_controlled");
            entity
                .Property(e => e.Code)
                .HasMaxLength(255)
                .HasComment("设备编码")
                .HasColumnName("code");
            entity
                .Property(e => e.CreateTime)
                .HasComment("创建时间")
                .HasColumnType("datetime")
                .HasColumnName("create_time");
            entity
                .Property(e => e.CreateUser)
                .HasMaxLength(255)
                .HasComment("创建人")
                .HasColumnName("create_user");
            entity
                .Property(e => e.DeptGuid)
                .HasMaxLength(64)
                .HasComment("用户部门ID")
                .HasColumnName("dept_guid");
            //entity.Property(e => e.DetectCycle)
            //    .HasMaxLength(255)
            //    .HasColumnName("detect_cycle");
            entity
                .Property(e => e.InstallationDate)
                .HasComment("设备安装时间")
                .HasColumnType("datetime")
                .HasColumnName("installation_date");
            entity.Property(e => e.Installer).HasMaxLength(255).HasColumnName("installer");
            entity
                .Property(e => e.LastMaintenanceTime)
                .HasComment("上次维保时间")
                .HasColumnType("datetime")
                .HasColumnName("last_maintenance_time");
            //entity.Property(e => e.Level)
            //    .HasMaxLength(255)
            //    .HasColumnName("level");
            entity
                .Property(e => e.MaintenanceCompanyGuid)
                .HasMaxLength(255)
                .HasComment("维保公司guid")
                .HasColumnName("maintenance_company_guid");
            entity
                .Property(e => e.Name)
                .HasMaxLength(255)
                .HasComment("设备名称")
                .HasColumnName("name");
            entity
                .Property(e => e.NextMaintenanceTime)
                .HasComment("计划下次维保时间")
                .HasColumnType("datetime")
                .HasColumnName("next_maintenance_time");
            entity
                .Property(e => e.OnlineStatusConfig)
                .HasMaxLength(255)
                .HasComment("在线状态读取点位guid")
                .HasColumnName("online_status_config");
            entity
                .Property(e => e.Position)
                .HasMaxLength(255)
                .HasComment("设备地址")
                .HasColumnName("position");
            //entity.Property(e => e.PrecisionStr)
            //    .HasMaxLength(255)
            //    .HasColumnName("precision_str");
            entity
                .Property(e => e.ProductionCompany)
                .HasMaxLength(255)
                .HasComment("生产公司")
                .HasColumnName("production_company");
            entity
                .Property(e => e.PurchaseTime)
                .HasColumnType("datetime")
                .HasColumnName("purchase_time");
            entity.Property(e => e.Purchaser).HasMaxLength(255).HasColumnName("purchaser");
            entity.Property(e => e.RegisterCode).HasMaxLength(255).HasColumnName("register_code");
            entity
                .Property(e => e.RegisterStateGuid)
                .HasMaxLength(255)
                .HasColumnName("register_state_guid");
            entity
                .Property(e => e.RegisterStateKey)
                .HasMaxLength(255)
                .HasColumnName("register_state_key");
            entity.Property(e => e.SpaceGuid).HasMaxLength(255).HasColumnName("space_guid");
            entity
                .Property(e => e.Status)
                .HasComment("状态，1：空闲中，2：使用中，3：维护中，4：借用中")
                .HasColumnName("status");
            //entity.Property(e => e.StorageLocation)
            //    .HasMaxLength(255)
            //    .HasColumnName("storage_location");
            entity.Property(e => e.Supplier).HasMaxLength(255).HasColumnName("supplier");
            entity
                .Property(e => e.SystemClassification)
                .HasMaxLength(255)
                .HasComment("所属系统分类")
                .HasColumnName("system_classification");
            //entity.Property(e => e.TestScope)
            //    .HasMaxLength(255)
            //    .HasColumnName("test_scope");
            entity
                .Property(e => e.Type)
                .HasMaxLength(255)
                .HasComment("设备类型")
                .HasColumnName("type");
            entity
                .Property(e => e.UpdateTime)
                .HasComment("修改时间")
                .HasColumnType("datetime")
                .HasColumnName("update_time");
            entity
                .Property(e => e.UpdateUser)
                .HasMaxLength(255)
                .HasComment("修改人")
                .HasColumnName("update_user");
            //entity.Property(e => e.UseDept)
            //    .HasMaxLength(255)
            //    .HasColumnName("use_dept");
            entity.Property(e => e.UseType).HasDefaultValueSql("'0'").HasColumnName("use_type");
            //entity.Property(e => e.UserName)
            //    .HasMaxLength(255)
            //    .HasColumnName("user_name");
            entity.Property(e => e.Valid).HasComment("有效状态").HasColumnName("valid");
        });

        modelBuilder.Entity<TSafeMonitor>(entity =>
        {
            entity.HasKey(e => e.Guid).HasName("PRIMARY");

            entity.ToTable("t_safe_monitor").UseCollation("utf8mb4_general_ci");

            entity.Property(e => e.Guid).HasMaxLength(36).HasColumnName("guid");
            entity
                .Property(e => e.Address)
                .HasMaxLength(255)
                .HasComment("ip地址")
                .HasColumnName("address");
            entity
                .Property(e => e.CreateTime)
                .HasColumnType("datetime")
                .HasColumnName("create_time");
            entity.Property(e => e.CreateUser).HasMaxLength(255).HasColumnName("create_user");
            entity.Property(e => e.DeptGuid).HasMaxLength(255).HasColumnName("dept_guid");
            entity.Property(e => e.Location).HasMaxLength(255).HasColumnName("location");
            entity.Property(e => e.MonitorCode).HasMaxLength(255).HasColumnName("monitor_code");
            entity
                .Property(e => e.MonitorName)
                .HasMaxLength(255)
                .HasComment("监控名称")
                .HasColumnName("monitor_name");
            entity.Property(e => e.Port).HasComment("端口号").HasColumnName("port");
            entity.Property(e => e.TargetUrl).HasMaxLength(255).HasColumnName("target_url");
            entity.Property(e => e.RtspUrl).HasMaxLength(255).HasColumnName("rtsp_url");
            entity
                .Property(e => e.Type)
                .HasMaxLength(255)
                .HasComment("1海康 2大华")
                .HasColumnName("type");
            entity
                .Property(e => e.UpdateTime)
                .HasColumnType("datetime")
                .HasColumnName("update_time");
            entity.Property(e => e.UpdateUser).HasMaxLength(255).HasColumnName("update_user");
            entity.Property(e => e.Valid).HasColumnName("valid");
        });

        modelBuilder.Entity<TRegister>(entity =>
        {
            entity.HasKey(e => e.Code).HasName("PRIMARY");

            entity.ToTable("t_register").HasCharSet("utf8mb3").UseCollation("utf8mb3_general_ci");

            entity.Property(e => e.Code).HasComment("对象(设备)名").HasColumnName("code");
            entity
                .Property(e => e.Address1)
                .HasMaxLength(255)
                .HasComment("地址1 ip")
                .HasColumnName("address1");
            entity
                .Property(e => e.Address2)
                .HasMaxLength(255)
                .HasComment("地址2 端口")
                .HasColumnName("address2");
            entity
                .Property(e => e.Address3)
                .HasMaxLength(255)
                .HasComment("地址2 待定")
                .HasColumnName("address3");
            entity
                .Property(e => e.Address4)
                .HasMaxLength(255)
                .HasComment("地址2 待定")
                .HasColumnName("address4");
            entity.Property(e => e.CreateBy).HasMaxLength(255).HasColumnName("create_by");
            entity
                .Property(e => e.CreateTime)
                .HasColumnType("datetime")
                .HasColumnName("create_time");
            entity.Property(e => e.IsDelete).HasColumnType("bit(1)").HasColumnName("is_delete");
            entity.Property(e => e.ModbusStation).HasColumnName("modbus_station");
            entity.Property(e => e.ReadLength).HasColumnName("read_length");
            entity.Property(e => e.RegisterName).HasMaxLength(255).HasColumnName("register_name");
            entity.Property(e => e.TypeCode).HasMaxLength(255).HasColumnName("type_code");
            entity.Property(e => e.Types).HasMaxLength(255).HasColumnName("types");
            entity.Property(e => e.UpdateBy).HasMaxLength(255).HasColumnName("update_by");
            entity
                .Property(e => e.UpdateTime)
                .HasColumnType("datetime")
                .HasColumnName("update_time");
            entity
                .Property(e => e.ReadRange)
                .HasMaxLength(255)
                .HasColumnName("read_range");
        });

        modelBuilder.Entity<TRegisterStateKey>(entity =>
        {
            entity.HasKey(e => e.Guid).HasName("PRIMARY");

            entity
                .ToTable("t_register_state_key")
                .HasCharSet("utf8mb3")
                .UseCollation("utf8mb3_general_ci");

            entity.Property(e => e.Guid).HasMaxLength(36).HasComment("主键").HasColumnName("guid");
            entity.Property(e => e.BitKey).HasColumnName("bit_key");
            entity
                .Property(e => e.Composable)
                .HasComment("是否为复合型数据")
                .HasColumnName("composable");
            entity.Property(e => e.CreateBy).HasMaxLength(255).HasColumnName("create_by");
            entity
                .Property(e => e.CreateTime)
                .HasColumnType("datetime")
                .HasColumnName("create_time");
            entity
                .Property(e => e.DeviceName)
                .HasMaxLength(255)
                .HasComment("废弃")
                .HasColumnName("device_name");
            entity
                .Property(e => e.Formula)
                .HasMaxLength(255)
                .HasComment("公式用于得到显示值以及减少小数点 (${val}/10)-((${val}/10)%0.1)")
                .HasColumnName("formula");
            entity
                .Property(e => e.InputFormula)
                .HasMaxLength(255)
                .HasComment("从前端输入时的公式计算")
                .HasColumnName("input_formula");
            entity
                .Property(e => e.InputType)
                .HasMaxLength(255)
                .HasComment("输入类型 目前为input,select")
                .HasColumnName("input_type");
            entity
                .Property(e => e.IsDelete)
                .HasComment("整个key代表的含义 DB0代表 比如一组开关的显示值\r\n")
                .HasColumnName("is_delete");
            entity
                .Property(e => e.IsInterval)
                .HasMaxLength(255)
                .HasComment("默认定时器")
                .HasColumnName("is_interval");
            entity
                .Property(e => e.IsLazy)
                .HasMaxLength(255)
                .HasComment("使用cron 表达式")
                .HasColumnName("is_lazy");
            entity.Property(e => e.IsMain).HasComment("是否需要日志记录").HasColumnName("is_main");
            entity.Property(e => e.IsPulse).HasComment("脉冲信号（写）").HasColumnName("is_pulse");
            entity
                .Property(e => e.IsShow)
                .HasComment("是否显示在前端 其实没有用了现在")
                .HasColumnName("is_show");
            entity
                .Property(e => e.KeyName)
                .HasMaxLength(255)
                .HasComment("整个key代表的含义 DB0代表 比如一组开关的显示值")
                .HasColumnName("key_name");
            entity
                .Property(e => e.LogRate)
                .HasMaxLength(255)
                .HasComment("${addMs}日志频率,阈值日志 ${val}")
                .HasColumnName("log_rate");
            entity
                .Property(e => e.ReadType)
                .HasComment(" 0只写 1只读 2读写")
                .HasColumnName("read_type");
            entity
                .Property(e => e.RegisterCode)
                .HasMaxLength(255)
                .HasComment("register 的code")
                .HasColumnName("register_code");
            entity.Property(e => e.Room).HasMaxLength(255).HasComment("废弃").HasColumnName("room");
            entity
                .Property(e => e.ScanIntervalMs)
                .HasComment("定时器时间")
                .HasColumnName("scan_interval_ms");
            entity
                .Property(e => e.ShowOrder)
                .HasMaxLength(255)
                .HasComment("展示时排序")
                .HasColumnName("show_order");
            entity
                .Property(e => e.StateGuid)
                .HasMaxLength(255)
                .HasComment("绑定的状态代码")
                .HasColumnName("state_guid");
            entity
                .Property(e => e.StateKey)
                .HasMaxLength(255)
                .HasComment("状态地址")
                .HasColumnName("state_key");
            entity
                .Property(e => e.StateName)
                .HasMaxLength(255)
                .HasComment("最小单位（包括bit）")
                .HasColumnName("state_name");
            entity
                .Property(e => e.Step)
                .HasMaxLength(255)
                .HasComment("步进步退值")
                .HasColumnName("step");
            entity
                .Property(e => e.TextFill)
                .HasMaxLength(255)
                .HasComment("算完公式后的内容填充常用于单位 ${val}℃")
                .HasColumnName("text_fill");
            entity.Property(e => e.UpdateBy).HasMaxLength(255).HasColumnName("update_by");
            entity
                .Property(e => e.UpdateTime)
                .HasColumnType("datetime")
                .HasColumnName("update_time");
            entity
                .Property(e => e.ValueRange)
                .HasMaxLength(255)
                .HasComment("数据范围 比如0-10")
                .HasColumnName("value_range");
            entity
                .Property(e => e.ValueType)
                .HasMaxLength(255)
                .HasComment(
                    "数据类型 分为\"整型\", \r\n\"双整型\"\r\n\"布尔型\",\r\n\"双浮点型\",\r\n\"浮点型\",\r\n\"位\", "
                )
                .HasColumnName("value_type");
            entity
                .Property(e => e.WarningLevel)
                .HasComment("报警等级1设备报警 2消防报警")
                .HasColumnName("warning_level");
            entity
                .Property(e => e.WarningRange)
                .HasMaxLength(255)
                .HasComment("报警值范围 布尔表达式")
                .HasColumnName("warning_range");
            entity
                .Property(e => e.WarningValue)
                .HasComment("到达这个值时触发报警")
                .HasColumnName("warning_value");
            entity
                .Property(e => e.WriteState)
                .HasMaxLength(255)
                .HasComment("如为读取 时的写入对应state_key的guid")
                .HasColumnName("write_state");
        });

        modelBuilder.Entity<TObjectAttribute>(entity =>
        {
            entity.HasKey(e => e.Guid).HasName("PRIMARY");

            entity.ToTable("t_object_attribute");

            entity
                .Property(e => e.Guid)
                .HasComment("唯一主键")
                .HasColumnName("guid")
                .UseCollation("utf8mb4_general_ci");
            entity
                .Property(e => e.CreateTime)
                .HasComment("创建时间")
                .HasColumnType("datetime")
                .HasColumnName("create_time");
            entity
                .Property(e => e.CreateUser)
                .HasMaxLength(255)
                .HasComment("创建人")
                .HasColumnName("create_user")
                .UseCollation("utf8mb4_general_ci");
            entity
                .Property(e => e.DeptGuid)
                .HasMaxLength(64)
                .HasComment("用户部门ID")
                .HasColumnName("dept_guid")
                .UseCollation("utf8mb4_general_ci");
            entity.Property(e => e.IsDefault).HasColumnName("is_default");
            entity.Property(e => e.Log).HasComment("是否需要记录").HasColumnName("log");
            entity
                .Property(e => e.LogRate)
                .HasComment("记录频率，秒为单位，60的倍数")
                .HasColumnName("log_rate");
            entity
                .Property(e => e.Name)
                .HasMaxLength(255)
                .HasComment("监测点名称")
                .HasColumnName("name")
                .UseCollation("utf8mb4_general_ci");
            entity
                .Property(e => e.ObjectGuid)
                .HasMaxLength(255)
                .HasComment("空间主键")
                .HasColumnName("object_guid")
                .UseCollation("utf8mb4_general_ci");
            entity.Property(e => e.Order).HasComment("显示顺序").HasColumnName("order");
            entity
                .Property(e => e.RecordType)
                .HasComment("1:读数据，2：写数据")
                .HasColumnName("record_type");
            entity
                .Property(e => e.RegisterCode)
                .HasMaxLength(255)
                .HasComment("寄存器编码")
                .HasColumnName("register_code")
                .UseCollation("utf8mb4_general_ci");
            entity
                .Property(e => e.RegisterStateGuid)
                .HasMaxLength(255)
                .HasComment("寄存器点位guid")
                .HasColumnName("register_state_guid")
                .UseCollation("utf8mb4_general_ci");
            entity
                .Property(e => e.RegisterStateKey)
                .HasMaxLength(255)
                .HasComment("寄存器点位地址")
                .HasColumnName("register_state_key")
                .UseCollation("utf8mb4_general_ci");
            entity
                .Property(e => e.RelatedAttributeGuid)
                .HasMaxLength(64)
                .HasComment("关联属性Guid")
                .HasColumnName("related_attribute_guid")
                .UseCollation("utf8mb4_general_ci");
            entity
                .Property(e => e.ShowTitle)
                .HasMaxLength(255)
                .HasComment("显示标题")
                .HasColumnName("show_title")
                .UseCollation("utf8mb4_general_ci");
            entity
                .Property(e => e.ShowValue)
                .HasMaxLength(255)
                .HasComment("显示值")
                .HasColumnName("show_value")
                .UseCollation("utf8mb4_general_ci");
            entity.Property(e => e.Type).HasColumnName("type");
            entity
                .Property(e => e.UpdateTime)
                .HasComment("修改时间")
                .HasColumnType("datetime")
                .HasColumnName("update_time");
            entity
                .Property(e => e.UpdateUser)
                .HasMaxLength(255)
                .HasComment("修改人")
                .HasColumnName("update_user")
                .UseCollation("utf8mb4_general_ci");
            entity.Property(e => e.Valid).HasComment("有效状态").HasColumnName("valid");
            entity
                .Property(e => e.ValueType)
                .HasMaxLength(255)
                .HasComment("值类型")
                .HasColumnName("value_type")
                .UseCollation("utf8mb4_general_ci");
            entity
                .Property(e => e.WarningGuid)
                .HasMaxLength(64)
                .HasComment("报警规则guid")
                .HasColumnName("warning_guid")
                .UseCollation("utf8mb4_general_ci");
        });

        modelBuilder.Entity<TAccount>(entity =>
        {
            entity.HasKey(e => e.Guid).HasName("PRIMARY");

            entity.ToTable("t_account").UseCollation("utf8mb4_general_ci");

            entity.Property(e => e.Guid).HasMaxLength(64).HasComment("主键").HasColumnName("guid");
            entity
                .Property(e => e.CreateTime)
                .HasComment("创建时间")
                .HasColumnType("datetime")
                .HasColumnName("create_time");
            entity
                .Property(e => e.CreateUser)
                .HasMaxLength(255)
                .HasComment("创建人")
                .HasColumnName("create_user");
            entity
                .Property(e => e.DeptGuid)
                .HasMaxLength(64)
                .HasComment("用户部门ID")
                .HasColumnName("dept_guid");
            entity
                .Property(e => e.Description)
                .HasMaxLength(255)
                .HasComment("描述、备注")
                .HasColumnName("description");
            entity
                .Property(e => e.DoorAccessPersonId)
                .HasMaxLength(255)
                .HasColumnName("door_access_person_id");
            entity
                .Property(e => e.EmailAddress)
                .HasMaxLength(255)
                .HasComment("邮箱地址")
                .HasColumnName("email_address");
            entity
                .Property(e => e.ExtraInfo)
                .HasComment("其他信息")
                .HasColumnType("json")
                .HasColumnName("extraInfo");
            entity.Property(e => e.InitPwd).HasComment("是否初始密码").HasColumnName("init_pwd");
            entity.Property(e => e.Openid).HasMaxLength(255).HasColumnName("openid");
            entity
                .Property(e => e.Password)
                .HasMaxLength(255)
                .HasComment("密码")
                .HasColumnName("password");
            entity
                .Property(e => e.Phone)
                .HasMaxLength(36)
                .HasComment("手机号")
                .HasColumnName("phone");
            entity.Property(e => e.ReportId).HasColumnName("report_id");
            entity
                .Property(e => e.RoleId)
                .HasMaxLength(64)
                .HasComment("角色ID")
                .HasColumnName("role_id");
            entity
                .Property(e => e.Status)
                .HasDefaultValueSql("'1'")
                .HasComment("状态 1->正常")
                .HasColumnName("status");
            entity.Property(e => e.Type).HasMaxLength(255).HasColumnName("type");
            entity
                .Property(e => e.UpdateTime)
                .HasComment("修改时间")
                .HasColumnType("datetime")
                .HasColumnName("update_time");
            entity
                .Property(e => e.UpdateUser)
                .HasMaxLength(255)
                .HasComment("修改人")
                .HasColumnName("update_user");
            entity
                .Property(e => e.UserId)
                .HasMaxLength(255)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity
                .Property(e => e.UserName)
                .HasMaxLength(255)
                .HasComment("用户名称")
                .HasColumnName("user_name");
            entity.Property(e => e.Valid).HasComment("有效状态").HasColumnName("valid");
        });

        modelBuilder.Entity<TAttributeRecord>(entity =>
        {
            entity.HasKey(e => e.Guid).HasName("PRIMARY");

            entity
                .ToTable("t_attribute_record", tb => tb.HasComment("空间/设备-寄存器-记录表"))
                .UseCollation("utf8mb4_general_ci");

            entity.Property(e => e.Guid).HasComment("唯一主键").HasColumnName("guid");
            entity
                .Property(e => e.AttributeGuid)
                .HasMaxLength(255)
                .HasComment("空间/设备-寄存器关系主键")
                .HasColumnName("attribute_guid");
            entity
                .Property(e => e.CreateTime)
                .HasComment("创建时间")
                .HasColumnType("datetime")
                .HasColumnName("create_time");
            entity
                .Property(e => e.CreateUser)
                .HasMaxLength(255)
                .HasComment("创建人")
                .HasColumnName("create_user");
            entity
                .Property(e => e.DeptGuid)
                .HasMaxLength(64)
                .HasComment("用户部门ID")
                .HasColumnName("dept_guid");
            entity
                .Property(e => e.FilledValue)
                .HasMaxLength(255)
                .HasComment("真实值")
                .HasColumnName("filled_value");
            entity
                .Property(e => e.LogTime)
                .HasComment("存储时间")
                .HasColumnType("datetime")
                .HasColumnName("log_time");
            entity
                .Property(e => e.ShowValue)
                .HasMaxLength(255)
                .HasComment("显示值")
                .HasColumnName("show_value");
            entity
                .Property(e => e.UpdateTime)
                .HasComment("修改时间")
                .HasColumnType("datetime")
                .HasColumnName("update_time");
            entity
                .Property(e => e.UpdateUser)
                .HasMaxLength(255)
                .HasComment("修改人")
                .HasColumnName("update_user");
            entity.Property(e => e.Valid).HasComment("有效状态").HasColumnName("valid");
        });

        modelBuilder.Entity<TEquipmentEnergyConsume>(entity =>
        {
            entity.HasKey(e => e.Guid).HasName("PRIMARY");

            entity.ToTable("t_equipment_energy_consume").UseCollation("utf8mb4_general_ci");

            entity.Property(e => e.Guid).HasMaxLength(36).HasComment("主键").HasColumnName("guid");
            entity.Property(e => e.ApiCode).HasMaxLength(255).HasColumnName("api_code");
            entity
                .Property(e => e.BillingStandards)
                .HasMaxLength(255)
                .HasColumnName("billing_standards");
            entity
                .Property(e => e.CollectionFrequency)
                .HasMaxLength(255)
                .HasComment("采集频率")
                .HasColumnName("collection_frequency");
            entity
                .Property(e => e.CollectionFrequencyUnit)
                .HasMaxLength(255)
                .HasComment("采集频率单位")
                .HasColumnName("collection_frequency_unit");
            entity
                .Property(e => e.CollectionType)
                .HasMaxLength(255)
                .HasColumnName("collection_type");
            entity
                .Property(e => e.CreateTime)
                .HasComment("创建时间")
                .HasColumnType("datetime")
                .HasColumnName("create_time");
            entity
                .Property(e => e.CreateUser)
                .HasMaxLength(255)
                .HasComment("创建人")
                .HasColumnName("create_user");
            entity
                .Property(e => e.DayCompareConfiguration)
                .HasComment("日比较分析配置")
                .HasColumnType("json")
                .HasColumnName("day_compare_configuration");
            entity
                .Property(e => e.DeptGuid)
                .HasMaxLength(255)
                .HasComment("用户部门id")
                .HasColumnName("dept_guid");
            entity
                .Property(e => e.EquipmentCode)
                .HasMaxLength(255)
                .HasComment("设备编码")
                .HasColumnName("equipment_code");
            entity.Property(e => e.EquipmentGuid).HasMaxLength(255).HasColumnName("equipment_guid");
            entity
                .Property(e => e.EquipmentName)
                .HasMaxLength(255)
                .HasComment("设备名称")
                .HasColumnName("equipment_name");
            entity
                .Property(e => e.EquipmentType)
                .HasMaxLength(255)
                .HasComment("设备类型")
                .HasColumnName("equipment_type");
            entity
                .Property(e => e.ExtremumConfiguration)
                .HasComment("极值分析配置")
                .HasColumnType("json")
                .HasColumnName("extremum_configuration");
            entity.Property(e => e.Flag).HasMaxLength(255).HasColumnName("flag");
            entity
                .Property(e => e.MaxEnergyConsume)
                .HasMaxLength(255)
                .HasColumnName("max_energy_consume");
            entity
                .Property(e => e.MaxEnergyConsumeUnit)
                .HasMaxLength(255)
                .HasColumnName("max_energy_consume_unit");
            entity.Property(e => e.ParentGuid).HasMaxLength(255).HasColumnName("parent_guid");
            entity.Property(e => e.RegisterCode).HasMaxLength(255).HasColumnName("register_code");
            entity
                .Property(e => e.RegisterId)
                .HasMaxLength(255)
                .HasComment("寄存器id")
                .HasColumnName("register_id");
            entity
                .Property(e => e.RegisterStateGuid)
                .HasMaxLength(255)
                .HasColumnName("register_state_guid");
            entity.Property(e => e.Remark).HasMaxLength(255).HasColumnName("remark");
            entity
                .Property(e => e.SpaceId)
                .HasMaxLength(255)
                .HasComment("空间id")
                .HasColumnName("space_id");
            entity
                .Property(e => e.SurfaceConfiguration)
                .HasComment("表面图分析配置")
                .HasColumnType("json")
                .HasColumnName("surface_configuration");
            entity
                .Property(e => e.UpdateTime)
                .HasComment("修改时间")
                .HasColumnType("datetime")
                .HasColumnName("update_time");
            entity
                .Property(e => e.UpdateUser)
                .HasMaxLength(255)
                .HasComment("修改人")
                .HasColumnName("update_user");
            entity.Property(e => e.Valid).HasComment("有效状态").HasColumnName("valid");
            entity.Property(e => e.WarnLevel).HasMaxLength(255).HasColumnName("warn_level");
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
